package com.hit.aircraftwar.supply;


import com.hit.aircraftwar.aircraft.AbstractAircraft;
import com.hit.aircraftwar.aircraft.EliteEnemy;
import com.hit.aircraftwar.bullet.AbstractBullet;

import java.util.ArrayList;
import java.util.List;

/**
 * @author LiuYuZhe
 */
public class BombSupply extends AbstractSupply {

    private final List<AbstractAircraft> aircraftList = new ArrayList<>();
    private final List<AbstractBullet> bulletList = new ArrayList<>();

    public void addObject(AbstractBullet bullet) {
        bulletList.add(bullet);
    }
    public void addObject(AbstractAircraft aircraft) {
        aircraftList.add(aircraft);
    }
    public void removeObject(AbstractAircraft aircraft, AbstractBullet bullet) {
        aircraftList.remove(aircraft);
        bulletList.remove(bullet);
    }

    public int notifyAllObject(){
        this.effectActive();
        int score = 0;
        for(AbstractAircraft aircraft : aircraftList) {
            aircraft.bombed();
            if(aircraft instanceof EliteEnemy) {
                score += 50;
            } else {
                score += 10;
            }
        }
        for(AbstractBullet bullet : bulletList) {
            bullet.bombed();
        }
        return score;
    }

    public BombSupply(int locationX, int locationY, int effect) {
        super(locationX, locationY, effect);
    }

    @Override
    public void effectActive() {}

}
